#ifndef OPERATION_H
#define OPERATION_H

#include <stdexcept>

class Operation
{
public:
    virtual double getResult(double numberA
                            ,double numberB) = 0;
};

class Add : public Operation
{
public:
    double getResult(double numberA
                    ,double numberB)
    {
        return numberA + numberB;
    }
};

class Subtract : public Operation
{
public:
    double getResult(double numberA
                    ,double numberB)
    {
        return numberA - numberB;
    }
};

class Multiply : public Operation
{
public:
    double getResult(double numberA
                    ,double numberB)
    {
        return numberA * numberB;
    }
};

class Divide : public Operation
{
public:
    double getResult(double numberA
                    ,double numberB)
    {
        if (numberB == 0)
        {
            throw std::invalid_argument("Divisor can not be 0.");
        }
        
        return numberA / numberB;
    }
};

#endif
